
***********Table 1: Summary Statistics*************

use "C:\Users\Amzad\Dropbox\UVA Collaboration\Child_Labor\Replication-JHR\masterfile.dta", clear

for var food_expenditure edu_original clothing health non_food_exp expenditure: gen X_per_capita_USD=(X/hhsize)/80
for var food_expenditure_per_capita_USD edu_original_per_capita_USD clothing_per_capita_USD health_per_capita_USD non_food_exp_per_capita_USD expenditure_per_capita_USD:replace X=0 if X==.
egen any_credit=rowmax(cr_bcup cr_any_ex_bcup)
egen amount_any=rsum(amount_any_ex_bcup amount_bcup)
egen rented_in_others=rsum( q415c2 q419c2)
gen co12a_usd=co12a/80
gen dum_self_employ_non_firm=(no_of_business!=0)
gen edu_exp_usd=edu_exp/80
gen edu_exp_usd_pc=(edu_exp_usd/dependent)*12 
replace edu_exp_usd_pc=0 if edu_exp_usd_pc==.
for var amount_bcup amount_bank_cooperative amount_ngo amount_informal amount_any_ex_bcup amount_any:gen X_usd=X/80
replace edu_head=0 if edu_head>16
for var never_attended currently_attending stopped_attending: replace X=0 if X==.

//Baseline Statistics for the control group//
for var hhsize workingage dependent femalehead age_head edu_head cr_bank_cooperative cr_ngo cr_informal cr_any_ex_bcup any_credit amount_bank_cooperative_usd amount_ngo_usd amount_informal_usd amount_any_ex_bcup_usd amount_any_usd q413c2 q417c2 rented_in_others  rentedin owned_land cultivatedland dum_self_employ_non_firm no_of_business co6 co7 co12a_usd dum_child_lab child_hours_hhprod  food_expenditure_per_capita_USD   non_food_exp_per_capita_USD edu_exp_usd_pc  total_cal_pc_day total_protien_pc_day never_attended  stopped_attending :sum X if phase==2012 & program==0

//Difference in  Baseline Means between Treatment and Control Groups//

reg hhsize program if phase==2012, cluster(bocd)
outreg2 using "summary-stat.xls", replace stats(coef se pval)
foreach var of varlist  workingage dependent femalehead age_head edu_head cr_bank_cooperative cr_ngo cr_informal cr_any_ex_bcup any_credit amount_bank_cooperative_usd amount_ngo_usd amount_informal_usd amount_any_ex_bcup_usd amount_any_usd q413c2 q417c2 rented_in_others  rentedin owned_land cultivatedland dum_self_employ_non_firm no_of_business co6 co7 co12a_usd dum_child_lab child_hours_hhprod  food_expenditure_per_capita_USD   non_food_exp_per_capita_USD edu_exp_usd_pc  total_cal_pc_day total_protien_pc_day never_attended  stopped_attending {
    reg `var' program if phase==2012, cluster(bocd)
outreg2 using "summary-stat.xls",append dec(2) stats(coef se pval)

	}
	
iebaltab hhsize workingage dependent  femalehead edu_head cr_bank_cooperative cr_ngo cr_informal cr_any_ex_bcup any_credit amount_bank_cooperative_usd amount_ngo_usd amount_informal_usd amount_any_ex_bcup_usd amount_any_usd q417c2 rented_in_others  rentedin owned_land cultivatedland dum_self_employ_non_firm no_of_business co6 co7 co12a_usd dum_child_lab child_hours_hhprod  food_expenditure_per_capita_USD   non_food_exp_per_capita_USD edu_exp_usd_pc  total_cal_pc_day total_protien_pc_day if year==0 , stdev grpvar(program) onerow replace vce(cluster bocd) save("C:\Users\Amzad\Dropbox\UVA Collaboration\Child_Labor\Results\balancetable.xls")	
	
	
	
	
**********Table 2: Endline Attrition*********
use "C:\Users\Amzad\Dropbox\UVA Collaboration\Child_Labor\Replication-JHR\attrition.dta", clear

//Panel A: End line attrition in treatment vs.  control//
gen found_in_baseline=1- attrition
ttest found_in_baseline,by(program)

 egen hh_size=rsum(workingage dependent)
//Panel B: Compositional changes in sample at endline//

reg hh_size program attrition c.program#c.attrition, cluster(bocd)
outreg2 using "attrition.xls",replace
foreach var of varlist    dependent age_head   edu_head female_headed  owned_land clvt  {
    reg `var' program attrition c.program#c.attrition, cluster(bocd)
outreg2 using "attrition.xls",append

	}
	
	
	
**********Table 3:Impact of BCUP on Credit Market Participation***********

use "C:\Users\Amzad\Dropbox\UVA Collaboration\Child_Labor\Replication-JHR\masterfile.dta", clear

//Panel A: Credit Market Participation//
xtset idno year
egen any_credit=rowmax(cr_bcup cr_any_ex_bcup)
local cr_institution " cr_bank_cooperative cr_ngo cr_informal cr_any_ex_bcup any_credit"
reg cr_bcup program l.cr_bcup, cluster(bocd) 
	qui summ cr_bcup if program == 0 & year==1
outreg2 using "credit_uptake.xls", addstat("Endline control mean", `r(mean)') replace dec(3)

foreach i of loc cr_institution {
	reg `i' program l.`i', cluster(bocd)
	qui summ `i' if program == 0 & year==1
	outreg2 using "credit_uptake.xls", append addstat("Endline control mean", `r(mean)') dec(3)

}



//Panel B: Borrowing Amount (in USD)//
xtset idno year
egen amount_any=rsum(amount_any_ex_bcup amount_bcup)
for var amount_bcup amount_bank_cooperative amount_ngo amount_informal amount_any_ex_bcup amount_any:gen X_usd=X/80
local cr_amount " amount_bank_cooperative_usd amount_ngo_usd amount_informal_usd amount_any_ex_bcup_usd amount_any_usd"
reg amount_bcup_usd program l.amount_bcup,  cluster(bocd) 
	qui summ amount_bcup_usd if program == 0 & year==1

outreg2 using "credit_amount.xls", replace addstat("Endline control mean", `r(mean)') dec(2)

foreach i of loc cr_amount {
	reg `i' program l.`i',  cluster(bocd)
		qui summ `i' if program == 0 & year==1

	outreg2 using "credit_amount.xls", append addstat("Endline control mean", `r(mean)') dec(2)

}


**********Table 4:  Impact of credit on Amount of Cultivated Land (in Decimal)*********
use "C:\Users\Amzad\Dropbox\UVA Collaboration\Child_Labor\Replication-JHR\masterfile.dta", clear
xtset idno year
egen rented_in_others=rsum( q415c2 q419c2)
reg q413c2 program l.q413c2 , cluster(bocd)
	qui summ q413c2 if program == 0 & year==1
outreg2 using "land.xls", replace addstat("Endline control mean", `r(mean)') dec(2)

local land_amount " q417c2 rented_in_others  rentedin owned_land cultivatedland"

foreach i of loc land_amount {
	reg `i' program l.`i',  cluster(bocd)
		qui summ `i' if program == 0 & year==1

	outreg2 using "land.xls", append addstat("Endline control mean", `r(mean)') dec(2)

}

***********Table 5: Impact of Credit on Non-farm Self-Employment Activities***

use "C:\Users\Amzad\Dropbox\UVA Collaboration\Child_Labor\Replication-JHR\masterfile.dta", clear
xtset idno year
gen co12a_usd=co12a/80
gen dum_self_employ_non_firm=(no_of_business!=0)
reg dum_self_employ_non_firm program l.dum_self_employ_non_firm, cluster(bocd)
	qui summ dum_self_employ_non_firm if program == 0 & year==1
outreg2 using "business.xls", replace addstat("Endline control mean", `r(mean)')

local self_employment "no_of_business co6 co7 co12a_usd "
foreach i of loc self_employment {
	reg `i' program l.`i',  cluster(bocd)
		qui summ `i' if program == 0 & year==1

	outreg2 using "business.xls", append addstat("Endline control mean", `r(mean)') dec(2)

}


**********Table 6: Impact of Credit on the Probability that Household Employs Child Labor (5-14)******
use "C:\Users\Amzad\Dropbox\UVA Collaboration\Child_Labor\Replication-JHR\masterfile.dta", clear
xtset idno year


*gen dum_child_lab=0 if child_hours_hhprod==0
*replace dum_child_lab=1 if dum_child_lab==.
*gen cat_child_lab=d.dum_child_lab
gen new_child_lab_endline=1 if cat_child_lab==1
replace new_child_lab_endline=0 if new_child_lab_endline==.

reg dum_child_lab program l.dum_child_lab , cluster(bocd)
	qui summ dum_child_lab if program == 0 & year==1
outreg2 using "child_labor_dummy.xls", replace addstat("Endline control mean", `r(mean)') dec(2)

reg new_child_lab_endline program l.new_child_lab_endline , cluster(bocd)
	qui summ new_child_lab_endline if program == 0 & year==1
outreg2 using "child_labor_dummy.xls", append addstat("Endline control mean", `r(mean)') dec(2)

reg child_hours_hhprod program l.child_hours_hhprod , cluster(bocd)
	qui summ child_hours_hhprod if program == 0 & year==1
outreg2 using "child_labor_dummy.xls", append addstat("Endline control mean", `r(mean)') dec(2)




*************Table 7: Impact of Credit on Hours Worked by Children on Different Activities: Time Budget Survey***

use  "C:\Users\Amzad\Dropbox\UVA Collaboration\Child_Labor\Replication-JHR\time_budget_hh-with_reading_indivdual.dta", clear

 merge m:1 idno phase using "C:\Users\Amzad\Dropbox\UVA Collaboration\Child_Labor\Replication-JHR\masterfile.dta"
 keep if _merge==3
 gen xx=1 
 bys idno: egen y=sum(xx)
 drop if y==1
 egen total_hrs=rsum(hr_wage hr_farm_self_employ hr_non_farm_self hr_Salary hr_hh_activities hr_non_econ_act hr_reading hr_oth_service hr_leisure)
 
 keep if age<15
 drop if ( total_hrs <=0 | total_hrs >169)
 gen post=(phase==2014)
 
 egen hr_wage_sal=rsum(hr_wage hr_Salary hr_oth_service)
 egen hr_self_employment=rsum(hr_farm_self_employ hr_non_farm_self)
 gen discrepency=(168-total_hrs)
 egen hr_non_econ_act_rev=rsum(hr_non_econ_act discrepency)

 
 cd "C:\Users\Amzad\Dropbox\UVA Collaboration\Child_Labor\Replication-JHR\Results"
 capture erase "TB_individual_level_children.xls"
  capture erase "TB_individual_level_children.txt"

 foreach var in hr_wage_sal hr_self_employment hr_hh_activities hr_reading hr_leisure hr_non_econ_act_rev{
 reg `var' c.post##c.program
 		qui summ `var' if program == 0 & year==1
	outreg2 using "TB_individual_level_children.xls", append addstat("Endline control mean", `r(mean)') dec(2)

 }
 
  cd "C:\Users\Amzad\Dropbox\UVA Collaboration\Child_Labor\Replication-JHR\Results"
 capture erase "TB_individual_level_children_male.xls"
  capture erase "TB_individual_level_children_male.txt"

 foreach var in hr_wage_sal hr_self_employment hr_hh_activities hr_reading hr_leisure hr_non_econ_act_rev{
 reg `var' c.post##c.program if sex==1
 		qui summ `var' if program == 0 & year==1 & sex==1
	outreg2 using "TB_individual_level_children_male.xls", append addstat("Endline control mean", `r(mean)') dec(2)

 }
 
   cd "C:\Users\Amzad\Dropbox\UVA Collaboration\Child_Labor\Replication-JHR\Results"
 capture erase "TB_individual_level_children_female.xls"
  capture erase "TB_individual_level_children_female.txt"

 foreach var in hr_wage_sal hr_self_employment hr_hh_activities hr_reading hr_leisure hr_non_econ_act_rev{
 reg `var' c.post##c.program if sex==2
 		qui summ `var' if program == 0 & year==1 & sex==2
	outreg2 using "TB_individual_level_children_female.xls", append addstat("Endline control mean", `r(mean)') dec(2)

 }

 



****Table 8: Heterogeneity in the Impact of Credit on the Use of Child Labor (5-14)*************

use "C:\Users\Amzad\Dropbox\UVA Collaboration\Child_Labor\Replication-JHR\masterfile.dta", clear
xtset idno year
reg  dum_child_lab program c.program#c.l.workingage  l.dum_child_lab hhsize, cluster(bocd)
qui summ dum_child_lab if program == 0 & year==1
outreg2 using "child_labor_heterogeneity.xls", replace addstat("Endline control mean", `r(mean)') dec(3)

reg dum_child_lab program c.program#c.l.femalehead l.dum_child_lab hhsize, cluster(bocd)
qui summ dum_child_lab if program == 0 & year==1
outreg2 using "child_labor_heterogeneity.xls", append addstat("Endline control mean", `r(mean)') dec(3)

reg child_hours_hhprod program c.program#c.l.workingage l.child_hours_hhprod hhsize, cluster(bocd)
qui summ child_hours_hhprod if program == 0 & year==1
outreg2 using "child_labor_heterogeneity.xls", append addstat("Endline control mean", `r(mean)') dec(3)

reg child_hours_hhprod program c.program#c.femalehead l.child_hours_hhprod hhsize , cluster(bocd)
qui summ child_hours_hhprod if program == 0 & year==1
outreg2 using "child_labor_heterogeneity.xls", append addstat("Endline control mean", `r(mean)') dec(3)








********Table 9:Impact of Credit on Monthly Education Expenditure*******
use "C:\Users\Amzad\Dropbox\UVA Collaboration\Child_Labor\Replication-JHR\masterfile.dta", clear
xtset idno year

gen edu_exp_usd=edu_exp/80
gen edu_exp_usd_pc=(edu_exp_usd/dependent)*12 
replace edu_exp_usd_pc=0 if edu_exp_usd_pc==.
reg edu_exp_usd_pc program l.edu_exp_usd_pc, cluster(bocd)
qui summ edu_exp_usd_pc if program == 0 & year==1
outreg2 using "edu_exp.xls", replace dec(2) addstat("Endline control mean", `r(mean)') 

reg edu_exp_usd_pc program l.edu_exp_usd_pc tret_workmem , cluster(bocd)
qui summ edu_exp_usd_pc if program == 0 & year==1
outreg2 using "edu_exp.xls", append dec(2) addstat("Endline control mean", `r(mean)')

reg edu_exp_usd_pc program l.edu_exp_usd_pc  c.program#c.l.femalehead, cluster(bocd)
qui summ edu_exp_usd_pc if program == 0 & year==1
outreg2 using "edu_exp.xls", append dec(2) addstat("Endline control mean", `r(mean)') 


*********Table 10: Impact (ITT) of Credit on Child Schooling (Between 5 to 14 Years)*

use "C:\Users\Amzad\Dropbox\Women empowerment\Data and analysis\Revised Analysis\masterfile_women_empowerment.dta", clear
for var never_attended currently_attending stopped_attending: gen X_missing=(X==.)
for var never_attended currently_attending stopped_attending: replace X=0 if X==.
xtset idno year
reg never_attended program l.never_attended, cluster(bocd)
qui summ never_attended if program == 0 & year==1
outreg2 using "schooling_outcome.xls", replace dec(3) addstat("Endline control mean", `r(mean)') 
reg never_attended program l.never_attended l.workingage c.program#c.l.workingage, cluster(bocd)
qui summ never_attended if program == 0 & year==1
outreg2 using "schooling_outcome.xls", append dec(3) addstat("Endline control mean", `r(mean)') 
reg never_attended program l.never_attended l.femalehead c.program#c.l.femalehead, cluster(bocd)
qui summ never_attended if program == 0 & year==1
outreg2 using "schooling_outcome.xls", append dec(3) addstat("Endline control mean", `r(mean)') 

reg stopped_attending program l.stopped_attending , cluster(bocd)
qui summ stopped_attending if program == 0 & year==1
outreg2 using "schooling_outcome.xls", append dec(3) addstat("Endline control mean", `r(mean)') 
reg stopped_attending program l.stopped_attending l.workingage c.program#c.l.workingage, cluster(bocd)
qui summ stopped_attending if program == 0 & year==1
outreg2 using "schooling_outcome.xls", append dec(3) addstat("Endline control mean", `r(mean)') 	
reg stopped_attending program l.stopped_attending l.femalehead c.program#c.l.femalehead, cluster(bocd)
qui summ stopped_attending if program == 0 & year==1
outreg2 using "schooling_outcome.xls", append dec(3) addstat("Endline control mean", `r(mean)') 	









**********************************************************************************************
**********************************Appendix Tables *********************************************
**********************************************************************************************

**********Appendix  Table A1: Endline Attrition*********
use "C:\Users\Amzad\Dropbox\UVA Collaboration\Child_Labor\Replication-JHR\attrition.dta", clear
merge 1:1 idno using  "C:\Users\Amzad\Dropbox\UVA Collaboration\Child_Labor\Replication-JHR\baseline_hh_data.dta"
gen electricity=( q14111<6)
gen concrete_wall=( q145==1 )

reg attrition  program , cluster(bocd)
outreg2 using "attrition.xls",replace

reg attrition  program female_headed edu_head   hhsize q142 electricity concrete_wall      owned_land clvt inchh, cluster(bocd)
outreg2 using "attrition.xls",append

**************Appendix Table A2: Determinants of BCUP uptake****************************


use "C:\Users\Amzad\Dropbox\UVA Collaboration\Child_Labor\Replication-JHR\masterfile.dta", clear

for var food_expenditure edu_original clothing health non_food_exp expenditure: gen X_per_capita_USD=(X/hhsize)/80
for var food_expenditure_per_capita_USD edu_original_per_capita_USD clothing_per_capita_USD health_per_capita_USD non_food_exp_per_capita_USD expenditure_per_capita_USD:replace X=0 if X==.

//Panel A: Credit Market Participation//
xtset idno year
egen any_credit=rowmax(cr_bcup cr_any_ex_bcup)
local cr_institution " cr_bank_cooperative cr_ngo cr_informal cr_any_ex_bcup any_credit"
reg cr_bcup    l.femalehead l.age_head l.edu_head  l.cr_any_ex_bcup l.owned_land l.hhsize  l.cultivatedland l.expenditure_per_capita_USD   l.total_cal_pc_day l.total_protien_pc_day distance_mrkt distance_upz i.concrete_floor l.sanitary l.totalinc l.cow l.goat l.chicken l.pump if program==1, cluster(bocd)
 cd "C:\Users\Amzad\Dropbox\UVA Collaboration\Child_Labor\Replication-JHR\Results"
reg cr_bcup   l.workingage  l.femalehead l.age_head l.max_edu l.hhsize  l.cr_any_ex_bcup l.owned_land  l.cultivatedland l.expenditure_per_capita_USD   l.total_cal_pc_day l.total_protien_pc_day distance_mrkt distance_upz i.concrete_floor l.sanitary l.totalinc l.cow l.goat l.chicken l.pump if program==1, cluster(bocd)
outreg2 using "bcup_determinants.xls", replace  



****Appendix Table A3:  Multinomial Logit specification of the impact of credit on child labor
use "C:\Users\Amzad\Dropbox\UVA Collaboration\Child_Labor\Replication-JHR\masterfile.dta", clear
xtset idno year

mlogit cat_child_lab program , cluster(bocd) baseoutcome(0)
mfx2, replace
outreg2 using "mlogit.xls", replace


******Table A4: Impact of Credit on Hours Worked by Adults (15-64 years) on Different Activities:Time Budget Survey
use "C:\Users\Amzad\Dropbox\UVA Collaboration\Child_Labor\Replication-JHR\time_budget_hh-with_reading_indivdual.dta", clear

 merge m:1 idno phase using "C:\Users\Amzad\Dropbox\UVA Collaboration\Child_Labor\Replication-JHR\masterfile.dta"
 keep if _merge==3
 gen xx=1 
 bys idno: egen y=sum(xx)
 drop if y==1
 egen total_hrs=rsum(hr_wage hr_farm_self_employ hr_non_farm_self hr_Salary hr_hh_activities hr_non_econ_act hr_reading hr_oth_service hr_leisure)
 
 keep if age>15 & age<=64
 drop if ( total_hrs <=0 | total_hrs >169)
 gen post=(phase==2014)
 
 egen hr_wage_sal=rsum(hr_wage hr_Salary hr_oth_service)
 egen hr_self_employment=rsum(hr_farm_self_employ hr_non_farm_self)
 gen discrepency=(168-total_hrs)
 egen hr_non_econ_act_rev=rsum(hr_non_econ_act discrepency)

 
 cd "C:\Users\Amzad\Dropbox\UVA Collaboration\Child_Labor\Replication-JHR\Results"
 capture erase "TB_individual_level_adults.xls"
  capture erase "TB_individual_level_adults.txt"

 foreach var in hr_wage_sal hr_self_employment hr_hh_activities hr_reading hr_leisure hr_non_econ_act_rev{
 reg `var' program if post==1, cluster(bocd)
 		qui summ `var' if program == 0 & year==1
	outreg2 using "TB_individual_level_adults.xls", append addstat("Endline control mean", `r(mean)') dec(2)

 }
 
  cd "C:\Users\Amzad\Dropbox\UVA Collaboration\Child_Labor\Replication-JHR\Results"
 capture erase "TB_individual_level_adults_male.xls"
  capture erase "TB_individual_level_adults_male.txt"

 foreach var in hr_wage_sal hr_self_employment hr_hh_activities hr_reading hr_leisure hr_non_econ_act_rev{
 reg `var' program if post==1 & sex==1, cluster(bocd)
 		qui summ `var' if program == 0 & year==1 & sex==1
	outreg2 using "TB_individual_level_adults_male.xls", append addstat("Endline control mean", `r(mean)') dec(2)

 }
 
   cd "C:\Users\Amzad\Dropbox\UVA Collaboration\Child_Labor\Replication-JHR\Results"
 capture erase "TB_individual_level_adults_female.xls"
  capture erase "TB_individual_level_adults_female.txt"

 foreach var in hr_wage_sal hr_self_employment hr_hh_activities hr_reading hr_leisure hr_non_econ_act_rev{
 reg `var' program if post==1 & sex==2, cluster(bocd)
 		qui summ `var' if program == 0 & year==1 & sex==2
	outreg2 using "TB_individual_level_adults_female.xls", append addstat("Endline control mean", `r(mean)') dec(2)

 }
 
 
 **********Table A5: Impact of Credit on Non-farm Self-Employment Activities by the Sex Of House-hold Head***********
 use "C:\Users\Amzad\Dropbox\UVA Collaboration\Child_Labor\Replication-JHR\masterfile.dta", clear
xtset idno year
gen co12a_usd=co12a/80
gen dum_self_employ_non_firm=(no_of_business!=0)
reg dum_self_employ_non_firm program l.dum_self_employ_non_firm c.program#c.l.femalehead l.femalehead, cluster(bocd)
	qui summ dum_self_employ_non_firm if program == 0 & year==1
outreg2 using "business.xls", replace addstat("Endline control mean", `r(mean)')

local self_employment "no_of_business co6 co7 co12a_usd "
foreach i of loc self_employment {
	reg `i' program l.`i' c.program#c.l.femalehead l.femalehead,  cluster(bocd)
		qui summ `i' if program == 0 & year==1

	outreg2 using "business.xls", append addstat("Endline control mean", `r(mean)') dec(2)

}

 
 ********Table A6: Heterogeneity in Child labor by Baseline Child Labor Use********
 use "C:\Users\Amzad\Dropbox\UVA Collaboration\Child_Labor\Replication-JHR\masterfile.dta", clear
xtset idno year

reg dum_child_lab program l.dum_child_lab c.program#c.l.dum_child_lab , cluster(bocd)
outreg2 using "child_lab_by_baseline_status.xls", replace
reg child_hours_hhprod program  l.dum_child_lab c.program#c.l.dum_child_lab , cluster(bocd)
outreg2 using "child_lab_by_baseline_status.xls", append


**********Table A7: Multiple Hypothesis Testing: Impact of Credit on Different Outcomes*************
use "C:\Users\Amzad\Dropbox\UVA Collaboration\Child_Labor\Replication-JHR\masterfile.dta", clear
xtset idno year
for var  farminc wageinc  businessinc  totalinc  expenditure: gen X_usd=X/80
local mht "  boroyield tyield amanhyv amanhybrid borohybrid farminc_usd wageinc_usd  businessinc_usd  totalinc_usd  expenditure_usd dum_child_lab child_hours_hhprod"
 cd "C:\Users\Amzad\Dropbox\UVA Collaboration\Child_Labor\Replication-JHR\Results"
		
reg amanyield program l.amanyield,  cluster(bocd) 
outreg2 using "outcome_mht1.xls", replace dec(2) label stats(coef se pval)

foreach i of loc mht {
	reg `i' program l.`i' ,  cluster(bocd)
	outreg2 using "outcome_mht1.xls", append dec(2) label stats(coef se pval)

}

use "C:\Users\Amzad\Dropbox\UVA Collaboration\Child_Labor\Replication-JHR\time_budget_hh-with_reading_indivdual.dta", clear
 merge m:1 idno phase using "C:\Users\Amzad\Dropbox\UVA Collaboration\Child_Labor\Data\masterfile.dta"

 keep if _merge==3
 gen xx=1 
 bys idno: egen y=sum(xx)
 drop if y==1
 egen total_hrs=rsum(hr_wage hr_farm_self_employ hr_non_farm_self hr_Salary hr_hh_activities hr_non_econ_act hr_reading hr_oth_service hr_leisure)
 
 keep if age<15
 drop if ( total_hrs <=0 | total_hrs >169)
 gen post=(phase==2014)
 
 egen hr_wage_sal=rsum(hr_wage hr_Salary hr_oth_service)
 egen hr_self_employment=rsum(hr_farm_self_employ hr_non_farm_self)
 gen discrepency=(168-total_hrs)
 egen hr_non_econ_act_rev=rsum(hr_non_econ_act discrepency)
 
 foreach var in hr_wage_sal hr_self_employment hr_reading {
 reg `var' c.post##c.program
	outreg2 using "outcome_mht2.xls", append dec(2) label stats(coef se pval)

 }



clear all
quietly gen float pval = .

display "***********************************"
display "Please paste the vector of p-values that you wish to test into the variable 'pval'"
display	"After pasting, type 'q' to resume"
display "***********************************"
/*
pval
0.01
0.20
0.10
0.02
0.00
0.00
0.20
0.32
0.04
0.47
0.63
0.04
0.01
0.36
0.03
0.01

*/

q
pause
*(1 variable, 5 observations pasted into data editor)
* Collect the total number of p-values tested

quietly sum pval
local totalpvals = r(N)

* Sort the p-values in ascending order and generate a variable that codes each p-value's rank

quietly gen int original_sorting_order = _n
quietly sort pval
quietly gen int rank = _n if pval~=.

* Set the initial counter to 1 

local qval = 1

* Generate the variable that will contain the BH (1995) q-values

gen bh95_qval = 1 if pval~=.

* Set up a loop that begins by checking which hypotheses are rejected at q = 1.000, then checks which hypotheses are rejected at q = 0.999, then checks which hypotheses are rejected at q = 0.998, etc.  The loop ends by checking which hypotheses are rejected at q = 0.001.

while `qval' > 0 {
	* Generate value qr/M
	quietly gen fdr_temp = `qval'*rank/`totalpvals'
	* Generate binary variable checking condition p(r) <= qr/M
	quietly gen reject_temp = (fdr_temp>=pval) if fdr_temp~=.
	* Generate variable containing p-value ranks for all p-values that meet above condition
	quietly gen reject_rank = reject_temp*rank
	* Record the rank of the largest p-value that meets above condition
	quietly egen total_rejected = max(reject_rank)
	* A p-value has been rejected at level q if its rank is less than or equal to the rank of the max p-value that meets the above condition
	replace bh95_qval = `qval' if rank <= total_rejected & rank~=.
	* Reduce q by 0.001 and repeat loop
	quietly drop fdr_temp reject_temp reject_rank total_rejected
	local qval = `qval' - .001
}
	
quietly sort original_sorting_order







***Table A8: Impact of Credit on the Probability that Household Uses Child Labor (5-14) in Self-Employment Activities: Evidence From SVRS Survey
use "C:\Users\Amzad\Dropbox\UVA Collaboration\Child_Labor\Replication-JHR\svrs.dta", clear

keep if upzila_code==134| upzila_code==173| upzila_code==602| upzila_code==603| upzila_code==607| upzila_code==651| upzila_code==632| upzila_code==694| upzila_code==1322| upzila_code==1379| upzila_code==1358| upzila_code==1918| upzila_code==1981| upzila_code==2769| upzila_code==2962| upzila_code==3558| upzila_code==4769| upzila_code==4827| upzila_code==4849| upzila_code==4879| upzila_code==4845| upzila_code==5270| upzila_code==5440| upzila_code==5454| upzila_code==5487| upzila_code==5678| upzila_code==5628| upzila_code==5924| upzila_code==2777| upzila_code==7247| upzila_code==7587| upzila_code==7619| upzila_code==7633| upzila_code==7855| upzila_code==8110| upzila_code==8112| upzila_code==8743| upzila_code==8867| upzila_code==9309| upzila_code==9376

gen treatment=1 if upzila_code==173|upzila_code==607|upzila_code==1322|upzila_code==1379|upzila_code==1358|upzila_code==1918|upzila_code==3558|upzila_code==4769|upzila_code==4827|upzila_code==4849|upzila_code==4879|upzila_code==4845|upzila_code==5270|upzila_code==5487|upzila_code==5924|upzila_code==7619|upzila_code==7633|upzila_code==8867|upzila_code==9309
replace treatment=0 if treatment==.


replace highest_class=. if highest_class>=17

gen married=0 if marital_status<=1
replace married=1 if married==.
replace married=. if marital_status==.
gen child_marriage=1 if married==1 & age<=18
replace child_marriage=0 if married==0 & age<=18
replace child_marriage=. if age>18
replace child_marriage=0 if married==. & age<=18

gen child_marriage_12_18=child_marriage
replace child_marriage_12_18=. if age<12


gen attending_school=1 if attend_school==1
replace attending_school=0 if attending_school==.
replace attending_school=. if attend_school ==.

replace attend_school_5_24=. if age<5 & age>24
replace attend_school_5_24=. if age<5 | age>24

gen drop_school_last_yr=1 if drop_school==1
replace drop_school_last_yr=0 if drop_school==2

gen write_letter_dummy=1 if write_letter==1
replace  write_letter_dummy=0 if write_letter==2

gen employed=1
replace employed=0 if occupation==0|occupation==24 | occupation==25| occupation>27
replace employed=. if occupation==99

gen employment_nonagri=1 if occupation>10 & occupation<24
replace employment_nonagri=0 if employment_nonagri==.
replace employment_nonagri=. if employed==.

gen employment_office_job=1 if occupation>10 & occupation<15
replace employment_office_job=0 if employment_office_job==.
replace employment_office_job=. if employed==.

gen sanitary_latrine=1 if latrine_type==1| latrine_type==2
replace sanitary_latrine=0 if sanitary_latrine==.
replace sanitary_latrine=. if latrine_type==.

gen post=(year>2012)
egen hhid=group( psu_no hh_no year)
collapse (max) employed (first) treatment post  sanitary_latrine  water_drinking source_light upzila_code  , by (hhid year)
reg employed treatment post c.treatment#c.post  if year!=2013 & sanitary_latrine!=.  , cluster(upzila_code)
outreg2 using "child_labor.xls", replace
reg employed treatment post c.treatment#c.post sanitary_latrine  i.water_drinking i.source_light if year!=2013  , cluster(upzila_code)
outreg2 using "child_labor.xls", append
sum employed if post==1 & treatment==0

*************Table A9: Impact of Credit on Hours Worked by Children of Different Age Groups: Time Budget Survey ***********

 /// Children (5-8))///////
 
use  "C:\Users\Amzad\Dropbox\UVA Collaboration\Child_Labor\Replication-JHR\time_budget_hh-with_reading_indivdual.dta", clear

 merge m:1 idno phase using "C:\Users\Amzad\Dropbox\UVA Collaboration\Child_Labor\Replication-JHR\masterfile.dta"
 keep if _merge==3
 gen xx=1 
 bys idno: egen y=sum(xx)
 drop if y==1
 egen total_hrs=rsum(hr_wage hr_farm_self_employ hr_non_farm_self hr_Salary hr_hh_activities hr_non_econ_act hr_reading hr_oth_service hr_leisure)
 
 keep if age>=5 & age<=8
 drop if ( total_hrs <=0 | total_hrs >169)
 gen post=(phase==2014)
 
 egen hr_wage_sal=rsum(hr_wage hr_Salary hr_oth_service)
 egen hr_self_employment=rsum(hr_farm_self_employ hr_non_farm_self)
 gen discrepency=(168-total_hrs)
 egen hr_non_econ_act_rev=rsum(hr_non_econ_act discrepency)

 
 cd "C:\Users\Amzad\Dropbox\UVA Collaboration\Child_Labor\Replication-JHR\Results"
 capture erase "TB_individual_level_by_age.xls"
  capture erase "TB_individual_level_by_age.txt"

  foreach var in hr_wage_sal hr_self_employment hr_hh_activities hr_reading hr_leisure hr_non_econ_act_rev{
 reg `var' c.post##c.program
 		qui summ `var' if program == 0 & year==1 
	outreg2 using "TB_individual_level_by_age.xls", append addstat("Endline control mean", `r(mean)') dec(2)

 }

*********************** Children (9-14) *************************
use  "C:\Users\Amzad\Dropbox\UVA Collaboration\Child_Labor\Replication-JHR\time_budget_hh-with_reading_indivdual.dta", clear

 merge m:1 idno phase using "C:\Users\Amzad\Dropbox\UVA Collaboration\Child_Labor\Replication-JHR\masterfile.dta"
 keep if _merge==3
 gen xx=1 
 bys idno: egen y=sum(xx)
 drop if y==1
 egen total_hrs=rsum(hr_wage hr_farm_self_employ hr_non_farm_self hr_Salary hr_hh_activities hr_non_econ_act hr_reading hr_oth_service hr_leisure)
 
 keep if age>=9 & age<=14
 drop if ( total_hrs <=0 | total_hrs >169)
 gen post=(phase==2014)
 
 egen hr_wage_sal=rsum(hr_wage hr_Salary hr_oth_service)
 egen hr_self_employment=rsum(hr_farm_self_employ hr_non_farm_self)
 gen discrepency=(168-total_hrs)
 egen hr_non_econ_act_rev=rsum(hr_non_econ_act discrepency)

 
 cd "C:\Users\Amzad\Dropbox\UVA Collaboration\Child_Labor\Replication-JHR\Results"
 capture erase "TB_individual_level_by_age.xls"
  capture erase "TB_individual_level_by_age.txt"

  foreach var in hr_wage_sal hr_self_employment hr_hh_activities hr_reading hr_leisure hr_non_econ_act_rev{
 reg `var' c.post##c.program 
 		qui summ `var' if program == 0 & year==1 
	outreg2 using "TB_individual_level_by_age.xls", append addstat("Endline control mean", `r(mean)') dec(2)

 }
 
 
 *********************** teens (15-19) *************************
use  "C:\Users\Amzad\Dropbox\UVA Collaboration\Child_Labor\Replication-JHR\time_budget_hh-with_reading_indivdual.dta", clear

 merge m:1 idno phase using "C:\Users\Amzad\Dropbox\UVA Collaboration\Child_Labor\Replication-JHR\masterfile.dta"
 keep if _merge==3
 gen xx=1 
 bys idno: egen y=sum(xx)
 drop if y==1
 egen total_hrs=rsum(hr_wage hr_farm_self_employ hr_non_farm_self hr_Salary hr_hh_activities hr_non_econ_act hr_reading hr_oth_service hr_leisure)
 
 keep if age>=15 & age<=19
 drop if ( total_hrs <=0 | total_hrs >169)
 gen post=(phase==2014)
 
 egen hr_wage_sal=rsum(hr_wage hr_Salary hr_oth_service)
 egen hr_self_employment=rsum(hr_farm_self_employ hr_non_farm_self)
 gen discrepency=(168-total_hrs)
 egen hr_non_econ_act_rev=rsum(hr_non_econ_act discrepency)

 
 cd "C:\Users\Amzad\Dropbox\UVA Collaboration\Child_Labor\Replication-JHR\Results"
 capture erase "TB_individual_level_by_age.xls"
  capture erase "TB_individual_level_by_age.txt"

  foreach var in hr_wage_sal hr_self_employment hr_hh_activities hr_reading hr_leisure hr_non_econ_act_rev{
 reg `var' c.post##c.program 
 		qui summ `var' if program == 0 & year==1 
	outreg2 using "TB_individual_level_by_age.xls", append addstat("Endline control mean", `r(mean)') dec(2)

 }


 
 
 
 *****************Table A12: Time Budget Survey Sample: Baseline Summary Statistics and Tests of Balance**************
use "C:\Users\Amzad\Dropbox\UVA Collaboration\Child_Labor\Replication-JHR\masterfile.dta", clear
merge 1:1 idno phase using "C:\Users\Amzad\Dropbox\UVA Collaboration\Child_Labor\Replication-JHR\time_budget_sample.dta",  keepusing (time_budget_sample)
keep if _merge==3
	
for var food_expenditure edu_original clothing health non_food_exp expenditure: gen X_per_capita_USD=(X/hhsize)/80
for var food_expenditure_per_capita_USD edu_original_per_capita_USD clothing_per_capita_USD health_per_capita_USD non_food_exp_per_capita_USD expenditure_per_capita_USD:replace X=0 if X==.
egen any_credit=rowmax(cr_bcup cr_any_ex_bcup)
egen amount_any=rsum(amount_any_ex_bcup amount_bcup)
egen rented_in_others=rsum( q415c2 q419c2)
gen co12a_usd=co12a/80
gen dum_self_employ_non_firm=(no_of_business!=0)
gen edu_exp_usd=edu_exp/80
gen edu_exp_usd_pc=(edu_exp_usd/dependent)*12 
replace edu_exp_usd_pc=0 if edu_exp_usd_pc==.
for var amount_bcup amount_bank_cooperative amount_ngo amount_informal amount_any_ex_bcup amount_any:gen X_usd=X/80
replace edu_head=0 if edu_head>16
for var never_attended currently_attending stopped_attending: replace X=0 if X==.

//Baseline Statistics for the control group//
for var hhsize workingage dependent femalehead age_head edu_head cr_bank_cooperative cr_ngo cr_informal cr_any_ex_bcup any_credit amount_bank_cooperative_usd amount_ngo_usd amount_informal_usd amount_any_ex_bcup_usd amount_any_usd q413c2 q417c2 rented_in_others  rentedin owned_land cultivatedland dum_self_employ_non_firm no_of_business co6 co7 co12a_usd dum_child_lab child_hours_hhprod  food_expenditure_per_capita_USD   non_food_exp_per_capita_USD edu_exp_usd_pc  total_cal_pc_day total_protien_pc_day never_attended  stopped_attending :sum X if phase==2012 & program==0

//Difference in  Baseline Means between Treatment and Control Groups//

reg hhsize program if phase==2012, cluster(bocd)
outreg2 using "summary-stat.xls", replace stats(coef se pval)
foreach var of varlist  workingage dependent femalehead age_head edu_head cr_bank_cooperative cr_ngo cr_informal cr_any_ex_bcup any_credit amount_bank_cooperative_usd amount_ngo_usd amount_informal_usd amount_any_ex_bcup_usd amount_any_usd q413c2 q417c2 rented_in_others  rentedin owned_land cultivatedland dum_self_employ_non_firm no_of_business co6 co7 co12a_usd dum_child_lab child_hours_hhprod  food_expenditure_per_capita_USD   non_food_exp_per_capita_USD edu_exp_usd_pc  total_cal_pc_day total_protien_pc_day never_attended  stopped_attending {
    reg `var' program if phase==2012, cluster(bocd)
outreg2 using "summary-stat.xls",append dec(2) stats(coef se pval)

	}
	
iebaltab hhsize workingage dependent femalehead age_head edu_head cr_bank_cooperative cr_ngo cr_informal cr_any_ex_bcup any_credit amount_bank_cooperative_usd amount_ngo_usd amount_informal_usd amount_any_ex_bcup_usd amount_any_usd q417c2 rented_in_others  rentedin owned_land cultivatedland dum_self_employ_non_firm no_of_business co6 co7 co12a_usd dum_child_lab child_hours_hhprod  food_expenditure_per_capita_USD   non_food_exp_per_capita_USD edu_exp_usd_pc  total_cal_pc_day total_protien_pc_day never_attended  stopped_attending if year==0 , stdev grpvar(program) onerow replace vce(cluster bocd) save("C:\Users\Amzad\Dropbox\UVA Collaboration\Child_Labor\Results\balancetable_time-budget.xls")	
	

*****************************************************************************************************************
**************************Appendix B: LATE Estimates*************************************************************
*****************************************************************************************************************


********Table B1:  LATE Estimates of Impact of BCUP on Credit Market Participation****
use "C:\Users\Amzad\Dropbox\UVA Collaboration\Child_Labor\Replication-JHR\masterfile.dta", clear
xtset idno year


//Panel A: Credit Market Participation//
xtset idno year
egen any_credit=rowmax(cr_bcup cr_any_ex_bcup)
local cr_institution "  cr_ngo cr_informal cr_any_ex_bcup any_credit"
ivreg2 cr_bank_cooperative (cr_bcup=program) l.cr_bank_cooperative , cluster(bocd) 
	qui summ cr_bcup if program == 0 & year==1
outreg2 using "credit_uptake.xls", addstat("Endline control mean", `r(mean)') replace dec(3)

foreach i of loc cr_institution {
	ivreg2 `i' (cr_bcup=program) l.`i', cluster(bocd)
	qui summ `i' if program == 0 & year==1
	outreg2 using "credit_uptake.xls", append addstat("Endline control mean", `r(mean)') dec(3)

}


//Panel B: Borrowing Amount (in USD)//
xtset idno year
egen amount_any=rsum(amount_any_ex_bcup amount_bcup)
for var amount_bcup amount_bank_cooperative amount_ngo amount_informal amount_any_ex_bcup amount_any:gen X_usd=X/80
ivreg2 amount_bcup_usd (cr_bcup=program) l.amount_bcup,  cluster(bocd) 
	qui summ amount_bcup_usd if program == 0 & year==1

outreg2 using "credit_amount.xls", replace addstat("Endline control mean", `r(mean)') dec(2)

local cr_amount " amount_bank_cooperative_usd amount_ngo_usd amount_informal_usd amount_any_ex_bcup_usd amount_any_usd"

foreach i of loc cr_amount {
	ivreg2 `i' (cr_bcup=program) l.`i',  cluster(bocd)
		qui summ `i' if program == 0 & year==1

	outreg2 using "credit_amount.xls", append addstat("Endline control mean", `r(mean)') dec(2)

}



*********Table B2:LATE Estimates of the Impact of credit on Amount of Cultivated Land (in Decimal)***********
use "C:\Users\Amzad\Dropbox\UVA Collaboration\Child_Labor\Replication-JHR\masterfile.dta", clear
xtset idno year

xtset idno year
egen rented_in_others=rsum( q415c2 q419c2)
ivreg2 q413c2 (cr_bcup=program) l.q413c2 , cluster(bocd)
	qui summ q413c2 if program == 0 & year==1
outreg2 using "land.xls", replace addstat("Endline control mean", `r(mean)') dec(2)

local land_amount " q417c2 rented_in_others  rentedin owned_land cultivatedland"

foreach i of loc land_amount {
	ivreg2 `i' (cr_bcup=program) l.`i',  cluster(bocd)
		qui summ `i' if program == 0 & year==1

	outreg2 using "land.xls", append addstat("Endline control mean", `r(mean)') dec(2)

}



********Table B3: LATE Estimates of the Impact of credit on Non-firm Self-Employment Activities******
use "C:\Users\Amzad\Dropbox\UVA Collaboration\Child_Labor\Replication-JHR\masterfile.dta", clear
xtset idno year

gen co12a_usd=co12a/80
gen dum_self_employ_non_firm=(no_of_business!=0)
ivreg2 dum_self_employ_non_firm (cr_bcup=program) l.dum_self_employ_non_firm, cluster(bocd)
	qui summ dum_self_employ_non_firm if program == 0 & year==1
outreg2 using "business.xls", replace addstat("Endline control mean", `r(mean)')

local self_employment "no_of_business co6 co7 co12a_usd "
foreach i of loc self_employment {
	ivreg2 `i' (cr_bcup=program) l.`i',  cluster(bocd)
		qui summ `i' if program == 0 & year==1

	outreg2 using "business.xls", append addstat("Endline control mean", `r(mean)') dec(2)

}



******Table B4: LATE Estimates of the Impact of Credit on the Probability that Household Employs Child Labor (5-14)****
use "C:\Users\Amzad\Dropbox\UVA Collaboration\Child_Labor\Replication-JHR\masterfile.dta", clear
xtset idno year

gen new_child_lab_endline=1 if cat_child_lab==1
replace new_child_lab_endline=0 if new_child_lab_endline==.

ivreg2 dum_child_lab (cr_bcup=program) l.dum_child_lab , cluster(bocd)
	qui summ dum_child_lab if program == 0 & year==1
outreg2 using "child_labor_dummy.xls", replace addstat("Endline control mean", `r(mean)') dec(2)

ivreg2 new_child_lab_endline (cr_bcup=program) l.new_child_lab_endline , cluster(bocd)
	qui summ new_child_lab_endline if program == 0 & year==1
outreg2 using "child_labor_dummy.xls", append addstat("Endline control mean", `r(mean)') dec(2)

ivreg2 child_hours_hhprod (cr_bcup=program) l.child_hours_hhprod , cluster(bocd)
	qui summ child_hours_hhprod if program == 0 & year==1
outreg2 using "child_labor_dummy.xls", append addstat("Endline control mean", `r(mean)') dec(2)





********************************************************************************************
**********************************Appendix C: Difference-in-differencesestimates*************************
**********************************************************************************************

	
**********Table C1: DID Estimates of the Impact of BCUP on Credit Market Participation***********

use "C:\Users\Amzad\Dropbox\UVA Collaboration\Child_Labor\Replication-JHR\masterfile.dta", clear

//Panel A: Credit Market Participation//
xtset idno year
egen any_credit=rowmax(cr_bcup cr_any_ex_bcup)
local cr_institution " cr_bank_cooperative cr_ngo cr_informal cr_any_ex_bcup any_credit"
reg d.cr_bcup program , cluster(bocd) 
	qui summ cr_bcup if program == 0 & year==1
outreg2 using "credit_uptake.xls", addstat("Endline control mean", `r(mean)') replace dec(3)

foreach i of loc cr_institution {
	reg d.`i' program , cluster(bocd)
	qui summ `i' if program == 0 & year==1
	outreg2 using "credit_uptake.xls", append addstat("Endline control mean", `r(mean)') dec(3)

}


//Panel B: Borrowing Amount (in USD)//
xtset idno year
egen amount_any=rsum(amount_any_ex_bcup amount_bcup)
for var amount_bcup amount_bank_cooperative amount_ngo amount_informal amount_any_ex_bcup amount_any:gen X_usd=X/80
local cr_amount " amount_bank_cooperative_usd amount_ngo_usd amount_informal_usd amount_any_ex_bcup_usd amount_any_usd"
reg d.amount_bcup_usd program ,  cluster(bocd) 
	qui summ amount_bcup_usd if program == 0 & year==1

outreg2 using "credit_amount.xls", replace addstat("Endline control mean", `r(mean)') dec(2)

foreach i of loc cr_amount {
	reg d.`i' program ,  cluster(bocd)
		qui summ `i' if program == 0 & year==1

	outreg2 using "credit_amount.xls", append addstat("Endline control mean", `r(mean)') dec(2)

}


**********Table C2: DID Estimates of the Impact of credit on Amount of Cultivated Land (in Decimal)*********
use "C:\Users\Amzad\Dropbox\UVA Collaboration\Child_Labor\Replication-JHR\masterfile.dta", clear
xtset idno year
egen rented_in_others=rsum( q415c2 q419c2)
reg d.q413c2 program  , cluster(bocd)
	qui summ q413c2 if program == 0 & year==1
outreg2 using "land.xls", replace addstat("Endline control mean", `r(mean)') dec(2)

local land_amount " q417c2 rented_in_others  rentedin owned_land cultivatedland"

foreach i of loc land_amount {
	reg d.`i' program ,  cluster(bocd)
		qui summ `i' if program == 0 & year==1

	outreg2 using "land.xls", append addstat("Endline control mean", `r(mean)') dec(2)

}

***********Table C3: DID Estimates of the Impact of Credit on Non-farm Self-Employment Activities***

use "C:\Users\Amzad\Dropbox\UVA Collaboration\Child_Labor\Replication-JHR\masterfile.dta", clear
xtset idno year
gen co12a_usd=co12a/80
gen dum_self_employ_non_firm=(no_of_business!=0)
cgmreg d.dum_self_employ_non_firm program , cluster(bocd)
	qui summ dum_self_employ_non_firm if program == 0 & year==1
outreg2 using "business.xls", replace addstat("Endline control mean", `r(mean)')

local self_employment "no_of_business co6 co7 co12a_usd "
foreach i of loc self_employment {
	cgmreg d.`i' program ,  cluster(bocd)
		qui summ `i' if program == 0 & year==1

	outreg2 using "business.xls", append addstat("Endline control mean", `r(mean)') dec(2)

}


**********Table C4: Impact of Credit on the Probability that Household Employs Child Labor (5-14)******
use "C:\Users\Amzad\Dropbox\UVA Collaboration\Child_Labor\Replication-JHR\masterfile.dta", clear
xtset idno year


*gen dum_child_lab=0 if child_hours_hhprod==0
*replace dum_child_lab=1 if dum_child_lab==.
*gen cat_child_lab=d.dum_child_lab
gen new_child_lab_endline=1 if cat_child_lab==1
replace new_child_lab_endline=0 if new_child_lab_endline==.

reg d.dum_child_lab program  , cluster(bocd)
	qui summ dum_child_lab if program == 0 & year==1
outreg2 using "child_labor_dummy.xls", replace addstat("Endline control mean", `r(mean)') dec(3)


reg d.child_hours_hhprod program  , cluster(bocd)
	qui summ child_hours_hhprod if program == 0 & year==1
outreg2 using "child_labor_dummy.xls", append addstat("Endline control mean", `r(mean)') dec(3)








*********************************************************************************************
**************************Appendix D: Regression Using Only Endline Data Using Endline Data Only*******************************************************
**********************************************************************************************

	
**********Table D1:Impact of BCUP on Credit Market Participation***********

use "C:\Users\Amzad\Dropbox\UVA Collaboration\Child_Labor\Replication-JHR\masterfile.dta", clear

//Panel A: Credit Market Participation//
xtset idno year
egen any_credit=rowmax(cr_bcup cr_any_ex_bcup)
local cr_institution " cr_bank_cooperative cr_ngo cr_informal cr_any_ex_bcup any_credit"
reg cr_bcup program if year==1 , cluster(bocd) 
	qui summ cr_bcup if program == 0 & year==1
outreg2 using "credit_uptake.xls", addstat("Endline control mean", `r(mean)') replace dec(3)

foreach i of loc cr_institution {
	reg `i' program if year==1 , cluster(bocd)
	qui summ `i' if program == 0 & year==1
	outreg2 using "credit_uptake.xls", append addstat("Endline control mean", `r(mean)') dec(3)

}


//Panel B: Borrowing Amount (in USD)//
xtset idno year
egen amount_any=rsum(amount_any_ex_bcup amount_bcup)
for var amount_bcup amount_bank_cooperative amount_ngo amount_informal amount_any_ex_bcup amount_any:gen X_usd=X/80
local cr_amount " amount_bank_cooperative_usd amount_ngo_usd amount_informal_usd amount_any_ex_bcup_usd amount_any_usd"
reg amount_bcup_usd program if year==1 ,  cluster(bocd) 
	qui summ amount_bcup_usd if program == 0 & year==1

outreg2 using "credit_amount.xls", replace addstat("Endline control mean", `r(mean)') dec(2)

foreach i of loc cr_amount {
	reg `i' program if year==1 ,  cluster(bocd)
		qui summ `i' if program == 0 & year==1

	outreg2 using "credit_amount.xls", append addstat("Endline control mean", `r(mean)') dec(2)

}


**********Table D2:  Impact of credit on Amount of Cultivated Land (in Decimal)*********
use "C:\Users\Amzad\Dropbox\UVA Collaboration\Child_Labor\Replication-JHR\masterfile.dta", clear
xtset idno year
egen rented_in_others=rsum( q415c2 q419c2)
reg q413c2 program if year==1  , cluster(bocd)
	qui summ q413c2 if program == 0 & year==1
outreg2 using "land.xls", replace addstat("Endline control mean", `r(mean)') dec(2)

local land_amount " q417c2 rented_in_others  rentedin owned_land cultivatedland"

foreach i of loc land_amount {
	reg `i' program if year==1,  cluster(bocd)
		qui summ `i' if program == 0 & year==1

	outreg2 using "land.xls", append addstat("Endline control mean", `r(mean)') dec(2)

}

***********Table D3: Impact of Credit on Non-farm Self-Employment Activities***

use "C:\Users\Amzad\Dropbox\UVA Collaboration\Child_Labor\Replication-JHR\masterfile.dta", clear
xtset idno year
gen co12a_usd=co12a/80
gen dum_self_employ_non_firm=(no_of_business!=0)
cgmreg dum_self_employ_non_firm program if year==1, cluster(bocd)
	qui summ dum_self_employ_non_firm if program == 0 & year==1
outreg2 using "business.xls", replace addstat("Endline control mean", `r(mean)')

local self_employment "no_of_business co6 co7 co12a_usd "
foreach i of loc self_employment {
	cgmreg `i' program if year==1,  cluster(bocd)
		qui summ `i' if program == 0 & year==1

	outreg2 using "business.xls", append addstat("Endline control mean", `r(mean)') dec(2)

}


**********Table D4: Impact of Credit on the Probability that Household Employs Child Labor (5-14)******
use "C:\Users\Amzad\Dropbox\UVA Collaboration\Child_Labor\Replication-JHR\masterfile.dta", clear
xtset idno year


gen new_child_lab_endline=1 if cat_child_lab==1
replace new_child_lab_endline=0 if new_child_lab_endline==.

reg dum_child_lab program if year==1  , cluster(bocd)
	qui summ dum_child_lab if program == 0 & year==1
outreg2 using "child_labor_dummy.xls", replace addstat("Endline control mean", `r(mean)') dec(3)


reg child_hours_hhprod program if year==1  , cluster(bocd)
	qui summ child_hours_hhprod if program == 0 & year==1
outreg2 using "child_labor_dummy.xls", append addstat("Endline control mean", `r(mean)') dec(3)






***************************************************************************************************
****************************Appendix E: Regression Using Lasso Controls ********************************************
***************************************************************************************************

**********Table E1:Impact of BCUP on Credit Market Participation Using Lasso Controls***********

use "C:\Users\Amzad\Dropbox\UVA Collaboration\Child_Labor\Replication-JHR\masterfile.dta", clear

for var food_expenditure edu_original clothing health non_food_exp expenditure: gen X_per_capita_USD=(X/hhsize)/80
for var food_expenditure_per_capita_USD edu_original_per_capita_USD clothing_per_capita_USD health_per_capita_USD non_food_exp_per_capita_USD expenditure_per_capita_USD:replace X=0 if X==.

//Panel A: Credit Market Participation//
xtset idno year
egen any_credit=rowmax(cr_bcup cr_any_ex_bcup)
local cr_institution " cr_bank_cooperative cr_ngo cr_informal cr_any_ex_bcup any_credit"
pdslasso cr_bcup program l.cr_bcup (l.hhsize l.workingage l.dependent l.femalehead l.age_head l.edu_head l.cr_bank_cooperative l.cr_grameen l.cr_bracothers l.cr_oth_ngo l.cr_informal l.cr_any_ex_bcup l.owned_land l.rentedin l.rentedout l.cultivatedland  l.food_expenditure_per_capita_USD l.edu_original_per_capita_USD l.clothing_per_capita_USD l.health_per_capita_USD l.non_food_exp_per_capita_USD l.expenditure_per_capita_USD l.total_cal_pc_day l.total_protien_pc_day distance_mrkt distance_upz i.concrete_floor l.sanitary l.totalinc l.cow l.goat l.chicken l.pump  ), cluster(bocd) 
	qui summ cr_bcup if program == 0 & year==1
outreg2 using "credit_uptake_lasso.xls", keep(program) addstat("Endline control mean", `r(mean)') replace dec(3)

foreach i of loc cr_institution {
	pdslasso `i' program  (l.hhsize l.workingage l.dependent l.femalehead l.age_head l.edu_head l.cr_bank_cooperative l.cr_grameen l.cr_bracothers l.cr_oth_ngo l.cr_informal l.cr_any_ex_bcup l.owned_land l.rentedin l.rentedout l.cultivatedland  l.food_expenditure_per_capita_USD l.edu_original_per_capita_USD l.clothing_per_capita_USD l.health_per_capita_USD l.non_food_exp_per_capita_USD l.expenditure_per_capita_USD l.total_cal_pc_day l.total_protien_pc_day distance_mrkt distance_upz i.concrete_floor l.sanitary l.totalinc l.cow l.goat l.chicken l.pump  ), cluster(bocd)
	qui summ `i' if program == 0 & year==1
	outreg2 using "credit_uptake_lasso.xls", append keep(program) addstat("Endline control mean", `r(mean)') dec(3)

}


//Panel B: Borrowing Amount (in USD)//
xtset idno year
egen amount_any=rsum(amount_any_ex_bcup amount_bcup)
for var amount_bcup amount_bank_cooperative amount_ngo amount_informal amount_any_ex_bcup amount_any:gen X_usd=X/80
local cr_amount " amount_bank_cooperative_usd amount_ngo_usd amount_informal_usd amount_any_ex_bcup_usd amount_any_usd"
pdslasso amount_bcup_usd program l.amount_bcup (l.hhsize l.workingage l.dependent l.femalehead l.age_head l.edu_head l.cr_bank_cooperative l.cr_grameen l.cr_bracothers l.cr_oth_ngo l.cr_informal l.cr_any_ex_bcup l.owned_land l.rentedin l.rentedout l.cultivatedland  l.food_expenditure_per_capita_USD l.edu_original_per_capita_USD l.clothing_per_capita_USD l.health_per_capita_USD l.non_food_exp_per_capita_USD l.expenditure_per_capita_USD l.total_cal_pc_day l.total_protien_pc_day distance_mrkt distance_upz i.concrete_floor l.sanitary l.totalinc l.cow l.goat l.chicken l.pump  ),  cluster(bocd) 
	qui summ amount_bcup_usd if program == 0 & year==1

outreg2 using "credit_amount_lasso.xls", replace keep(program) addstat("Endline control mean", `r(mean)') dec(2)

foreach i of loc cr_amount {
	pdslasso `i' program  (l.hhsize l.workingage l.dependent l.femalehead l.age_head l.edu_head l.cr_bank_cooperative l.cr_grameen l.cr_bracothers l.cr_oth_ngo l.cr_informal l.cr_any_ex_bcup l.owned_land l.rentedin l.rentedout l.cultivatedland  l.food_expenditure_per_capita_USD l.edu_original_per_capita_USD l.clothing_per_capita_USD l.health_per_capita_USD l.non_food_exp_per_capita_USD l.expenditure_per_capita_USD l.total_cal_pc_day l.total_protien_pc_day distance_mrkt distance_upz i.concrete_floor l.sanitary l.totalinc l.cow l.goat l.chicken l.pump  ),  cluster(bocd)
		qui summ `i' if program == 0 & year==1

	outreg2 using "credit_amount_lasso.xls", append keep(program) addstat("Endline control mean", `r(mean)') dec(2)

}


**********Table E2:  Impact of credit on Amount of Cultivated Land (in Decimal) Using Lasso Controls*********
use "C:\Users\Amzad\Dropbox\UVA Collaboration\Child_Labor\Replication-JHR\masterfile.dta", clear

for var food_expenditure edu_original clothing health non_food_exp expenditure: gen X_per_capita_USD=(X/hhsize)/80
for var food_expenditure_per_capita_USD edu_original_per_capita_USD clothing_per_capita_USD health_per_capita_USD non_food_exp_per_capita_USD expenditure_per_capita_USD:replace X=0 if X==.
xtset idno year
egen rented_in_others=rsum( q415c2 q419c2)
pdslasso q413c2 program l.q413c2 (l.hhsize l.workingage l.dependent l.femalehead l.age_head l.edu_head l.cr_bank_cooperative l.cr_grameen l.cr_bracothers l.cr_oth_ngo l.cr_informal l.cr_any_ex_bcup   l.food_expenditure_per_capita_USD l.edu_original_per_capita_USD l.clothing_per_capita_USD l.health_per_capita_USD l.non_food_exp_per_capita_USD l.expenditure_per_capita_USD l.total_cal_pc_day l.total_protien_pc_day distance_mrkt distance_upz i.concrete_floor l.sanitary l.totalinc l.cow l.goat l.chicken l.pump  ) , cluster(bocd)
	qui summ q413c2 if program == 0 & year==1
outreg2 using "land_lasso.xls", replace keep(program) addstat("Endline control mean", `r(mean)') dec(2)

local land_amount " q417c2 rented_in_others  rentedin owned_land cultivatedland"

foreach i of loc land_amount {
	pdslasso `i' program l.`i' (l.hhsize l.workingage l.dependent l.femalehead l.age_head l.edu_head l.cr_bank_cooperative l.cr_grameen l.cr_bracothers l.cr_oth_ngo l.cr_informal l.cr_any_ex_bcup   l.food_expenditure_per_capita_USD l.edu_original_per_capita_USD l.clothing_per_capita_USD l.health_per_capita_USD l.non_food_exp_per_capita_USD l.expenditure_per_capita_USD l.total_cal_pc_day l.total_protien_pc_day distance_mrkt distance_upz i.concrete_floor l.sanitary l.totalinc l.cow l.goat l.chicken l.pump  ),  cluster(bocd)
		qui summ `i' if program == 0 & year==1

	outreg2 using "land_lasso.xls", append keep(program) addstat("Endline control mean", `r(mean)') dec(2)

}

***********Table E3: Impact of Credit on Non-farm Self-Employment Activities Using Lasso Controls****

use "C:\Users\Amzad\Dropbox\UVA Collaboration\Child_Labor\Replication-JHR\masterfile.dta", clear

for var food_expenditure edu_original clothing health non_food_exp expenditure: gen X_per_capita_USD=(X/hhsize)/80
for var food_expenditure_per_capita_USD edu_original_per_capita_USD clothing_per_capita_USD health_per_capita_USD non_food_exp_per_capita_USD expenditure_per_capita_USD:replace X=0 if X==.
xtset idno year
gen co12a_usd=co12a/80
gen dum_self_employ_non_firm=(no_of_business!=0)
pdslasso dum_self_employ_non_firm program l.dum_self_employ_non_firm (l.hhsize l.workingage l.dependent l.femalehead l.age_head l.edu_head l.cr_bank_cooperative l.cr_grameen l.cr_bracothers l.cr_oth_ngo l.cr_informal l.cr_any_ex_bcup l.owned_land l.rentedin l.rentedout l.cultivatedland  l.food_expenditure_per_capita_USD l.edu_original_per_capita_USD l.clothing_per_capita_USD l.health_per_capita_USD l.non_food_exp_per_capita_USD l.expenditure_per_capita_USD l.total_cal_pc_day l.total_protien_pc_day distance_mrkt distance_upz i.concrete_floor l.sanitary l.totalinc l.cow l.goat l.chicken l.pump  ), cluster(bocd)
	qui summ dum_self_employ_non_firm if program == 0 & year==1
outreg2 using "business_lasso.xls", replace keep(program) addstat("Endline control mean", `r(mean)')

local self_employment "no_of_business co6 co7 co12a_usd "
foreach i of loc self_employment {
	pdslasso `i' program l.`i' (l.hhsize l.workingage l.dependent l.femalehead l.age_head l.edu_head l.cr_bank_cooperative l.cr_grameen l.cr_bracothers l.cr_oth_ngo l.cr_informal l.cr_any_ex_bcup l.owned_land l.rentedin l.rentedout l.cultivatedland  l.food_expenditure_per_capita_USD l.edu_original_per_capita_USD l.clothing_per_capita_USD l.health_per_capita_USD l.non_food_exp_per_capita_USD l.expenditure_per_capita_USD l.total_cal_pc_day l.total_protien_pc_day distance_mrkt distance_upz i.concrete_floor l.sanitary l.totalinc l.cow l.goat l.chicken l.pump  ),  cluster(bocd)
		qui summ `i' if program == 0 & year==1

	outreg2 using "business_lasso.xls", append keep(program) addstat("Endline control mean", `r(mean)') dec(2)

}


**********Table E4: Impact of Credit on the Probability that Household Employs Child Labor (5-14) Using Lasso Controls*******
use "C:\Users\Amzad\Dropbox\UVA Collaboration\Child_Labor\Replication-JHR\masterfile.dta", clear

for var food_expenditure edu_original clothing health non_food_exp expenditure: gen X_per_capita_USD=(X/hhsize)/80
for var food_expenditure_per_capita_USD edu_original_per_capita_USD clothing_per_capita_USD health_per_capita_USD non_food_exp_per_capita_USD expenditure_per_capita_USD:replace X=0 if X==.
xtset idno year


gen new_child_lab_endline=1 if cat_child_lab==1
replace new_child_lab_endline=0 if new_child_lab_endline==.

pdslasso dum_child_lab program l.dum_child_lab (l.hhsize l.workingage l.dependent l.femalehead l.age_head l.edu_head l.cr_bank_cooperative l.cr_grameen l.cr_bracothers l.cr_oth_ngo l.cr_informal l.cr_any_ex_bcup l.owned_land l.rentedin l.rentedout l.cultivatedland  l.food_expenditure_per_capita_USD l.edu_original_per_capita_USD l.clothing_per_capita_USD l.health_per_capita_USD l.non_food_exp_per_capita_USD l.expenditure_per_capita_USD l.total_cal_pc_day l.total_protien_pc_day distance_mrkt distance_upz i.concrete_floor l.sanitary l.totalinc l.cow l.goat l.chicken l.pump  ) , cluster(bocd)
	qui summ dum_child_lab if program == 0 & year==1
outreg2 using "child_labor_dummy_lasso.xls", replace keep(program) addstat("Endline control mean", `r(mean)') dec(2)

pdslasso new_child_lab_endline program l.new_child_lab_endline (l.hhsize l.workingage l.dependent l.femalehead l.age_head l.edu_head l.cr_bank_cooperative l.cr_grameen l.cr_bracothers l.cr_oth_ngo l.cr_informal l.cr_any_ex_bcup l.owned_land l.rentedin l.rentedout l.cultivatedland  l.food_expenditure_per_capita_USD l.edu_original_per_capita_USD l.clothing_per_capita_USD l.health_per_capita_USD l.non_food_exp_per_capita_USD l.expenditure_per_capita_USD l.total_cal_pc_day l.total_protien_pc_day distance_mrkt distance_upz i.concrete_floor l.sanitary l.totalinc l.cow l.goat l.chicken l.pump  ) , cluster(bocd)
	qui summ new_child_lab_endline if program == 0 & year==1
outreg2 using "child_labor_dummy_lasso.xls", append keep(program) addstat("Endline control mean", `r(mean)') dec(2)

pdslasso child_hours_hhprod program l.child_hours_hhprod (l.hhsize l.workingage l.dependent l.femalehead l.age_head l.edu_head l.cr_bank_cooperative l.cr_grameen l.cr_bracothers l.cr_oth_ngo l.cr_informal l.cr_any_ex_bcup l.owned_land l.rentedin l.rentedout l.cultivatedland  l.food_expenditure_per_capita_USD l.edu_original_per_capita_USD l.clothing_per_capita_USD l.health_per_capita_USD l.non_food_exp_per_capita_USD l.expenditure_per_capita_USD l.total_cal_pc_day l.total_protien_pc_day distance_mrkt distance_upz i.concrete_floor l.sanitary l.totalinc l.cow l.goat l.chicken l.pump  ) , cluster(bocd)
	qui summ child_hours_hhprod if program == 0 & year==1
outreg2 using "child_labor_dummy_lasso.xls", append keep(program) addstat("Endline control mean", `r(mean)') dec(2)






****************************************************************************************
*********************Appendix F: Regression Using Wild Cluster Bootstrap-t Procedure******
****************************************************************************************


**********Table F1:Impact of BCUP on Credit Market Participation***********

use "C:\Users\Amzad\Dropbox\UVA Collaboration\Child_Labor\Replication-JHR\masterfile.dta", clear

//Panel A: Credit Market Participation//
xtset idno year
egen any_credit=rowmax(cr_bcup cr_any_ex_bcup)
gen lag_any_credit=l.any_credit

for var cr_bcup cr_bank_cooperative cr_ngo cr_informal cr_any_ex_bcup :gen lag_X=l.X
local cr_institution " cr_bank_cooperative cr_ngo cr_informal cr_any_ex_bcup any_credit"
  xi:cgmwildboot  cr_bcup program lag_cr_bcup, cluster(bocd) bootcluster(bocd) reps(1000) seed(12345)
outreg2 using "credit_uptake.xls", replace dec(3) stats(coef se pval)

foreach i of loc cr_institution {
	xi:cgmwildboot `i' program lag_`i', cluster(bocd) bootcluster(bocd) reps(1000) seed(12345)
	outreg2 using "credit_uptake.xls", append dec(3) stats(coef se pval)

}

cd "C:\Users\Amzad\Dropbox\UVA Collaboration\Child_Labor\Results"
//Panel B: Borrowing Amount (in USD)//
xtset idno year
egen amount_any=rsum(amount_any_ex_bcup amount_bcup)
gen lag_amount_any=l.amount_any
for var amount_bcup amount_bank_cooperative amount_ngo amount_informal amount_any_ex_bcup:gen X_usd=X/80
for var amount_bcup_usd amount_bank_cooperative_usd amount_ngo_usd amount_informal_usd amount_any_ex_bcup_usd:gen lag_X=l.X

local cr_amount " amount_bank_cooperative_usd amount_ngo_usd amount_informal_usd amount_any_ex_bcup_usd amount_any"
cgmwildboot amount_bcup_usd program lag_amount_bcup,  cluster(bocd) bootcluster(bocd) reps(1000) seed(12345)
outreg2 using "credit_amount.xls", replace dec(2) stats(coef  pval)

foreach i of loc cr_amount {
	cgmwildboot `i' program lag_`i',  cluster(bocd) bootcluster(bocd) reps(1000) seed(12345)
	outreg2 using "credit_amount.xls", append dec(2) stats(coef  pval)

}


**********Table F2:  Impact of credit on Amount of Cultivated Land (in Decimal)*********


use "C:\Users\Amzad\Dropbox\UVA Collaboration\Child_Labor\Replication-JHR\masterfile.dta", clear
xtset idno year
egen rented_in_others=rsum( q415c2 q419c2)
for var q413c2 q417c2 rentedin rented_in_others  owned_land cultivatedland:gen lag_X=l.X

cgmwildboot  q413c2 program lag_q413c2 , cluster(bocd) bootcluster(bocd) reps(1000) seed(12345)
	qui summ q413c2 if program == 0 & year==1
outreg2 using "land.xls", replace addstat("Endline control mean", `r(mean)') dec(2)

local land_amount " q417c2 rented_in_others  rentedin owned_land cultivatedland"

foreach i of loc land_amount {
	cgmwildboot  `i' program lag_`i',  cluster(bocd) bootcluster(bocd) reps(1000) seed(12345)
		qui summ `i' if program == 0 & year==1

	outreg2 using "land.xls", append addstat("Endline control mean", `r(mean)') dec(2)

}




***********Table F3: Impact of Credit on Non-farm Self-Employment Activities***

use "C:\Users\Amzad\Dropbox\UVA Collaboration\Child_Labor\Replication-JHR\masterfile.dta", clear
xtset idno year
gen co12a_usd=co12a/80
gen dum_self_employ_non_firm=(no_of_business!=0)
for var dum_self_employ_non_firm no_of_business co6 co7 co12a_usd: gen lag_X=l.X
cgmwildboot dum_self_employ_non_firm program lag_dum_self_employ_non_firm, cluster(bocd) bootcluster(bocd) reps(1000) seed(12345)
outreg2 using "business.xls", replace

cgmwildboot no_of_business program lag_no_of_business, cluster(bocd) bootcluster(bocd) reps(1000) seed(12345)
outreg2 using "business.xls", append
cgmwildboot co6 program lag_co6 , cluster(bocd) bootcluster(bocd) reps(1000) seed(12345)
outreg2 using "business.xls", append
cgmwildboot co7 program lag_co7 , cluster(bocd) bootcluster(bocd) reps(1000) seed(12345)
outreg2 using "business.xls", append
cgmwildboot co12a_usd program lag_co12a_usd if co12a<730000 , cluster(bocd) bootcluster(bocd) reps(500) seed(12345)
outreg2 using "business.xls", append


**********Table F4: Impact of Credit on the Probability that Household Employs Child Labor (5-14)******
use "C:\Users\Amzad\Dropbox\UVA Collaboration\Child_Labor\Replication-JHR\masterfile.dta", clear
xtset idno year


*gen dum_child_lab=0 if child_hours_hhprod==0
*replace dum_child_lab=1 if dum_child_lab==.
*gen cat_child_lab=d.dum_child_lab
gen new_child_lab_endline=1 if cat_child_lab==1
replace new_child_lab_endline=0 if new_child_lab_endline==.
for var dum_child_lab new_child_lab_endline child_hours_hhprod: gen lag_X=l.X

cgmwildboot dum_child_lab program lag_dum_child_lab , cluster(bocd) bootcluster(bocd) reps(1000) seed(12345)
outreg2 using "child_labor_dummy.xls", replace
cgmwildboot new_child_lab_endline program lag_new_child_lab_endline , cluster(bocd) bootcluster(bocd) reps(1000) seed(12345)
outreg2 using "child_labor_dummy.xls", append
cgmwildboot child_hours_hhprod program  lag_child_hours_hhprod   , cluster(bocd) bootcluster(bocd) reps(1000) seed(12345)
outreg2 using "child_labor_dummy.xls", append



****************************************************************************************
*********************Appendix G: Regression Using Randomization Inference Proce-dure******
****************************************************************************************



**********Table G.1:Impact of BCUP on Credit Market Participation***********

use "C:\Users\Amzad\Dropbox\UVA Collaboration\Child_Labor\Replication-JHR\masterfile.dta", clear

//Panel A: Credit Market Participation//
xtset idno year
egen any_credit=rowmax(cr_bcup cr_any_ex_bcup)

for var cr_bcup cr_bank_cooperative cr_ngo cr_informal cr_any_ex_bcup any_credit:gen lag_X=l.X
local cr_institution " cr_bcup cr_bank_cooperative cr_ngo cr_informal cr_any_ex_bcup any_credit"

foreach i of loc cr_institution {
	reg `i' program l.`i', cluster(bocd)
ritest program _b[program], cluster(bocd) reps(1000) seed(12345)  : reg `i' program lag_`i', cluster(bocd) 

}



//Panel B: Borrowing Amount (in USD)//
xtset idno year
egen amount_any=rsum(amount_any_ex_bcup amount_bcup)
for var amount_bcup amount_bank_cooperative amount_ngo amount_informal amount_any_ex_bcup amount_any:gen X_usd=X/80

for var amount_bcup_usd amount_bank_cooperative_usd amount_ngo_usd amount_informal_usd amount_any_ex_bcup_usd amount_any_usd: gen lag_X=l.X
local cr_amount " amount_bcup_usd amount_bank_cooperative_usd amount_ngo_usd amount_informal_usd amount_any_ex_bcup_usd amount_any_usd"

foreach i of loc cr_amount {
ritest program _b[program], cluster(bocd) reps(1000) seed(12345)  : reg `i' program lag_`i', cluster(bocd) 

}


**********Table G2:  Impact of credit on Amount of Cultivated Land (in Decimal)*********
use "C:\Users\Amzad\Dropbox\UVA Collaboration\Child_Labor\Replication-JHR\masterfile.dta", clear
xtset idno year
egen rented_in_others=rsum( q415c2 q419c2)

for var q413c2 q417c2 rented_in_others  rentedin owned_land cultivatedland:gen lag_X=l.X

local land_amount "q413c2  q417c2 rented_in_others  rentedin owned_land cultivatedland"

foreach i of loc land_amount {
ritest program _b[program], cluster(bocd) reps(1000) seed(12345)  : reg `i' program lag_`i', cluster(bocd) 

}


***********Table G3: Impact of Credit on Non-farm Self-Employment Activities***

use "C:\Users\Amzad\Dropbox\UVA Collaboration\Child_Labor\Replication-JHR\masterfile.dta", clear
xtset idno year
gen co12a_usd=co12a/80
gen dum_self_employ_non_firm=(no_of_business!=0)

for var dum_self_employ_non_firm no_of_business co6 co7 co12a_usd:gen lag_X=l.X

local self_employment "dum_self_employ_non_firm no_of_business co6 co7 "
foreach i of loc self_employment {
ritest program _b[program], cluster(bocd) reps(1000) seed(12345)  : reg `i' program lag_`i', cluster(bocd) 

}

ritest program _b[program], cluster(bocd) reps(1000) seed(12345)  : reg co12a_usd program lag_co12a_usd if co12a<730000, cluster(bocd) 



**********Table G4: Impact of Credit on the Probability that Household Employs Child Labor (5-14)******
use "C:\Users\Amzad\Dropbox\UVA Collaboration\Child_Labor\Replication-JHR\masterfile.dta", clear
xtset idno year


*gen dum_child_lab=0 if child_hours_hhprod==0
*replace dum_child_lab=1 if dum_child_lab==.
*gen cat_child_lab=d.dum_child_lab
gen new_child_lab_endline=1 if cat_child_lab==1
replace new_child_lab_endline=0 if new_child_lab_endline==.
for var dum_child_lab new_child_lab_endline child_hours_hhprod:gen lag_X=l.X

ritest program _b[program], cluster(bocd) reps(1000) seed(12345)  : reg dum_child_lab program lag_dum_child_lab , cluster(bocd) 

ritest program _b[program], cluster(bocd) reps(1000) seed(12345)  : reg new_child_lab_endline program lag_new_child_lab_endline , cluster(bocd) 

ritest program _b[program], cluster(bocd) reps(1000) seed(12345)  : reg child_hours_hhprod program lag_child_hours_hhprod , cluster(bocd) 



